package com.glorystone.ins.service;

import com.glorystone.ins.common.common.PageVo;
import com.glorystone.ins.domain.CreditRecord;
import com.glorystone.ins.domain.CreditTotal;
import com.glorystone.ins.domain.DepositRecord;
import com.glorystone.ins.interceptor.PageList;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;


/**
 * Created by wangwei on 2018/3/14.
 */
public interface CreditTotalService {

    CreditTotal findCurrentByChannelId(Long channelId);

    PageList<CreditTotal> findHistoryList(PageVo vo);

    void save(CreditTotal total);


    /**
     * 操作额度接口
     * @param channelId 渠道id
     * @param operate 操作类型 1.// 1.使用 DECREASE  2.返还INCREASE
     * @param amount 操作金额
     * @param date 返回 日期字段， 根据该字段获取所在的账期
     * @return true|false
     */
    boolean operateCreditQuota(Long channelId, CreditRecord.TypeEnum operate, BigDecimal amount, LocalDate date);

    /**
     * 操作保证金接口
     * @param channelId 渠道id
     * @param operate 操作事项 // 1.缴纳保证金 2.补缴保证金 3.逾期扣款 4.退保扣款， 5.退回保证金 6.结算扣款
     * @param amount 操作金额
     * @param remark 备注
     * @return true|false
     */
    boolean operateDeposit(Long channelId, DepositRecord.TypeEnum operate, BigDecimal amount, String remark);

    void updateOffByChannelIds(List<Long> channelIds);

    /**
     * 查询所有生效中的授信信息
     * @return
     */
    List<CreditTotal> findActiveList();

    CreditTotal findPrePhase(Long channelId);
}
